package cn.muqingfeng.api.request;

import cn.muqingfeng.api.ApiContext;

import com.android.volley.Request;
import com.android.volley.Response.ErrorListener;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public abstract class BaseGsonRequest<T> extends Request<T> {

	protected boolean mNeedLogin;

	protected ApiContext mApiContext;

	public BaseGsonRequest(int method, String url, ErrorListener listener) {
		super(method, url, listener);
	}

	protected Gson createGson() {
		GsonBuilder gsonb = new GsonBuilder();
		gsonb.serializeNulls();
		Gson gson = gsonb.create();
		return gson;
	}

	public boolean isNeedLogin() {
		return mNeedLogin;
	}

	public void setNeedLogin(boolean need) {
		this.mNeedLogin = need;
	}

	public void setApiContext(ApiContext context) {
		this.mApiContext = context;
	}

}
